package com.gary.security.model;

import java.io.Serializable;

import java.util.HashSet;
import java.util.Set;

import com.gary.core.model.BaseModel;


public class RoleInfo extends BaseModel implements Serializable {
    /** * serial. */
    static final long serialVersionUID = 0L;

    /** * name. */
    private String name;

    /** * descn. */
    private String descn;

    /** * users. */
    private Set<UserInfo> users = new HashSet<UserInfo>(0);

    /** * rescs. */
    private Set<RescInfo> rescs = new HashSet<RescInfo>(0);

    /** * menus. */
    private Set<MenuInfo> menus = new HashSet<MenuInfo>(0);

    // ----------------------------------------------------
    // transient fields
    // ----------------------------------------------------
    /** * 是否授权. */
    private Boolean authorized;

    /** * 构造方法. */
    public RoleInfo() {
    }

    /** * @return name. */
    public String getName() {
        return name;
    }

    /** * @param name name. */
    public void setName(String name) {
        this.name = name;
    }

    /** * @return descn. */
    public String getDescn() {
        return descn;
    }

    /** * @param descn descn. */
    public void setDescn(String descn) {
        this.descn = descn;
    }

    /** * @return users. */
    public Set<UserInfo> getUsers() {
        return users;
    }

    /** * @param users users. */
    public void setUsers(Set<UserInfo> users) {
        this.users = users;
    }

    /** * @return rescs. */
    public Set<RescInfo> getRescs() {
        return rescs;
    }

    /** * @param rescs rescs. */
    public void setRescs(Set<RescInfo> rescs) {
        this.rescs = rescs;
    }

    /** * @return menus. */
    public Set<MenuInfo> getMenus() {
        return menus;
    }

    /** * @param menus menus. */
    public void setMenus(Set<MenuInfo> menus) {
        this.menus = menus;
    }

    public Boolean getAuthorized() {
        return authorized;
    }

    /** * @param authorized is authorized. */
    public void setAuthorized(Boolean authorized) {
        this.authorized = authorized;
    }

    /**
     * 判断相同.
     *
     * @param o Object
     * @return boolean
     */
    public boolean equals(Object o) {
        if (!(o instanceof RoleInfo)) {
            return false;
        } else {
            RoleInfo role = (RoleInfo) o;

            return role.id.equals(this.id);
        }
    }

    /** * @return hashCode. */
    public int hashCode() {
        if (this.id == null) {
            return super.hashCode();
        } else {
            return this.id.hashCode();
        }
    }
}
